package test;

import data.StringDataSetGeneratorLocale;
import implementation.sort.AbstractSorter;
import implementation.sort.HeapSort;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;


public class LocaleCollator {
    private static StringDataSetGeneratorLocale generator;


    public static void main(String[] args){
        HeapSort heap = new HeapSort();
        List<String> list = generateList();
        generator = new StringDataSetGeneratorLocale(Locale.FRENCH);

        printResult(list, heap, Locale.FRENCH);
        printResult(list, heap, Locale.ENGLISH);
        printResult(list, heap, new Locale("ES"));


    }

    private static void printResult(List<String> list, AbstractSorter sorter, Locale locale) {
        generator.setLocale(locale);
        sorter.sort(generator.getComparator(), list);
        System.out.println(locale);
        System.out.println(list);
    }


    private static List<String> generateList() {
        List<String> list = new ArrayList();
        list.add("llamado");
        list.add("lunes");
        list.add("péché");
        list.add("pêche");
        list.add("cerca");
        list.add("champán");
        list.add("clamor");
        return list;
    }


}
